import { S } from '../../s';
import { IPSAppDEAction } from '../dataentity/ipsapp-deaction';
import { IPSAppDEField } from '../dataentity/ipsapp-defield';
import { IPSAppDataEntity } from '../dataentity/ipsapp-data-entity';
import { IPSAppDERedirectView } from './ipsapp-deredirect-view';
import { IPSAppViewRef } from './ipsapp-view-ref';
import { PSAppDEViewImpl } from './psapp-deview-impl';

export class PSAppDERedirectViewImpl
  extends PSAppDEViewImpl
  implements IPSAppDERedirectView
{
  protected getdatapsappdeaction: IPSAppDEAction;
  getGetDataPSAppDEAction(): IPSAppDEAction | null {
    if (this.getdatapsappdeaction != null) return this.getdatapsappdeaction;
    const value = this.M.getGetDataPSAppDEAction;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.getdatapsappdeaction = ipsappdataentity.findPSAppDEAction(value);
    }
    return this.getdatapsappdeaction;
  }

  protected redirectpsappviewrefs: IPSAppViewRef[];
  getRedirectPSAppViewRefs(): IPSAppViewRef[] | null {
    return (
      this.redirectpsappviewrefs ||
      (this.redirectpsappviewrefs = this.fillChildListModel(
        this.M.getRedirectPSAppViewRefs,
        S._8d,
      ) as IPSAppViewRef[])
    );
  }

  protected typepsappdefield: IPSAppDEField;
  getTypePSAppDEField(): IPSAppDEField | null {
    if (this.typepsappdefield != null) return this.typepsappdefield;
    const value = this.M.getTypePSAppDEField;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.typepsappdefield = ipsappdataentity.findPSAppDEField(value);
    }
    return this.typepsappdefield;
  }

  get enableCustomGetDataAction(): boolean {
    return this.M.enableCustomGetDataAction;
  }

  get enableWorkflow(): boolean {
    return this.M.enableWorkflow;
  }

  get redirectView(): boolean {
    return this.M.redirectView;
  }
  get cls(): string {
    return 'PSAppDERedirectViewImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._2d || cls == S._2e) return true;
    return super.instanceof(cls);
  }
}
